package com.sqx.modules.sharingEncryption.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.sharingEncryption.entity.SharingEncryption;
import com.sqx.modules.sharingEncryption.service.SharingEncryptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description：TODO
 * @author： qiao
 * @create： 2024/12/12 16:18
 */
@RestController
@RequestMapping("/app/sharingEncryption")
@Api(value = "分享链接管理-用户端", tags = "分享链接管理-用户端")
public class SharingController {

    @Autowired
    private SharingEncryptionService sharingEncryptionService;

    @Login
    @PostMapping("/addSharingEncryption")
    @ApiOperation("添加分享链接")
    public Result addSharingEncryption(@ApiParam("分享实体") SharingEncryption sharingEncryption, @RequestAttribute("userId")Long userId){
        sharingEncryption.setUserId(userId);
        return sharingEncryptionService.addSharingEncryption(sharingEncryption);
    }

    @GetMapping("/selectByEncryptLink")
    @ApiOperation("根据加密链接查询分享信息")
    public Result selectByEncryptLink(@ApiParam("加密链接") String encryptLink){
        return sharingEncryptionService.selectByEncryptLink(encryptLink);
    }


}
